c###frqcom.for
      SUBROUTINE FRQCOM(FREA,IFREQ)
C--------------------------------
C
C     THIS ROUTINE SETS THE FREQUENCY COMPLEMENT FROM 2 TO 40 MHZ
C
C FREA(13) IS A FREQUENCY COMPLEMENT TO BE SET
      COMMON/MUFS/EMUF(24),F1MUF(24),F2MUF(24),ESMUF(24),ALLMUF(24)
     A,FOT(24),XLUF(24),HPF(24),ANGMUF(24),MODMUF,SIGL(4),SIGU(4),DELMUF
     B (4),HPMUF(4),HTMUF(4),FVMUF(4),AFMUF(4),NHOPMF(4),YFOT(4),YHPF(4)
     C ,YMUF(4)
      COMMON / TIME / IT, GMT, UTIME(24), GMTR, XLMT(24), ITIM, JTX
      DIMENSION FREA(13)
      DATA FLOW/2./, FHIGH/40./
C.....INSERT MUF INTO FREQUENCY SLOT 12
      FREA(12) = ALLMUF(IT)
      IF(IFREQ + 10) 95, 90, 95
C.....INSERT FOT INTO FREQUENCY SLOT 1
   90 FREA(1) = FOT(IT)
      RETURN
C GET MUF"S
   95 XFL = AMIN1(EMUF(IT) , F2MUF(IT) )
      XFH = HPF(IT)
      XFL = AMAX1(FLOW,XFL)
      XFH = AMIN1(XFH,FHIGH)
      IF(XFH- FLOW) 105,105,115
C.....CASE 1. NOT LIKELY TO OCCUR
  105 FREA(1) = FLOW
      DO 110 IF=2,11
      DELF = 2.
  110 FREA(IF) =    FREA(IF-1) +DELF
C.....END OF CASE 1
      RETURN
  115 IF(XFL - FLOW) 120,120,130
C.....CASE 2. NIGHTTIME
  120 DELF = (XFH -FLOW)/11.
      FREA(1) = FLOW
      DO 125 IF=2,11
  125 FREA(IF) = FREA(IF-1) +DELF
      FREA(13)= 0.0
      RETURN
C.....END OF CASE 2.
  130 IF( XFH - (FLOW + 20.)) 135,135,150
C.....CASE 3. INSERT SMALLER MUF, WITHIN EQUAL INCREMENTS
C.....RANGE .LE. 20 MHZ
  135 DELF = (XFH-FLOW)/9.
      NE = (XFL - FLOW)/DELF
      NE = NE +2
      FREA(1) = FLOW
      DO 140 IF = 2,NE
  140 FREA(IF) = FREA(IF-1) + DELF
       FREA(NE) = XFL
      FREA(NE+1) = FREA(NE-1) + DELF
      NE = NE+2
      NE = MIN0(NE,11)
      DO 145 IF=NE,11
  145 FREA(IF) = FREA(IF-1) +DELF
      FREA(13) =0.0
      RETURN
C.....END OF CASE 3.
  150 IF(XFL -(FLOW +2.) ) 155,155,165
C.....CASE 4.  INSERT LOWER MUF BETWEEN 2 AND 4 MHZ
C.....THEN EQUAL INCREMENTS FROM 4 MHZ TO 40 MHZ
  155 DELF = (XFH- (FLOW+2.))/9.
      FREA(1) = FLOW
      FREA(2) = XFL
      FREA(3) = FLOW + 2.
      DO 160 IF=4,11
  160 FREA(IF)= FREA(IF-1) +DELF
      FREA(13) = 0.0
      RETURN
C.....END OF CASE 4.
  165 IF( (FHIGH-2.) -FLOW) 185,185,166
C.....CASE 5.  EQUAL INCREMENTS TO LOWER MUF, THEN EQUAL INCREMENTS TO
C.....UPPER LIMIT
  166 NE = (XFL - FLOW)/2.
      NE = MIN0 (NE,7)
      XNE = NE
      DELF = (XFL - FLOW)/XNE
      FREA(1) = FLOW
      DO 170  IF=2,NE
  170 FREA(IF) = FREA(IF-1) + DELF
      XNE = NE
      DELF = (XFH - FREA(NE)) / (12.0 - XNE - 1.0)
      NE = NE +1
      DO 175 IF=NE,11
  175 FREA(IF) = FREA(IF-1) + DELF
      FREA(13) =0.0
      RETURN
C.....END OF CASE 5.
C
C.....CASE 6.  EQUAL INCREMENT TO LOWER MUF, NOT LIKELY TO OCCUR
  185 DELF = ( (FHIGH-2.) -FLOW)/9.
       FREA(1) =FLOW
       DO 190 IF = 2,10
  190 FREA(IF) = FREA(IF- 1) +DELF
       FREA(11) =XFL
      FREA(13) =0.0
      RETURN
C.....END OF CASE 6.
      END
CC*****************************************************************
